<?php
/**
 * --------------------------------------------------------------------
 * MCore精简框架
 * 作者：阿枫，QQ：52037872，Email：support@mdeve.com
 * --------------------------------------------------------------------
 *
 * SVN revision information:
 * @version $Revision: 1 $:
 * @author  $Author: zy $:
 * @date      $Date: 2017-03-10 21:12:21 +0800 (星期五, 10 三月 2017) $:
 */

/***********************************************************
 * 系统基类
 ***********************************************************/
class __basic_def {

    private static $_instance = array();

    /**
     * 自动变量设置
     * @access public
     * @param $name 属性名称
     * @param $value  属性值
     */
    public function __set($name ,$value){
        if(property_exists($this,$name))
            $this->$name = $value;
    }

    /**
     * 自动变量获取
     * @access public
     * @param $name 属性名称
     * @return mixed
     */
    public function __get($name)	{
        return isset($this->$name)?$this->$name:null;
    }

    function __call($name,$arguments) {
        echo "模块 {$name} 不存在！";
    }

    function _callStatic($name,$arguments){
        echo "静态模块 {$name} 不存在！";
    }

    public static function getInstance($arguments=null){
        if(!(self::$_instance instanceof self)){
            self::$_instance = new self($arguments);
        }
        return self::$_instance;
    }
    
    public function _decomposition_parameter($params = "") {
        if(!strlen($params)) return null;
        $result = array();
        $params_array = explode(",", $params);
        foreach($params_array as $param) {
            if(!strlen($param)) continue;
            $arr = explode(":", $param);
            if(sizeof($arr) == 1) $arr[1] = "";
            $result[$arr[0]] = $arr[1];
        }
        return $result;
    }

}